package com.stool.cloud.api;

import com.stool.cloud.common.CommonResult;
import com.stool.cloud.service.IStorageService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Felix YF Dong
 * @Description
 * @Date 2023/2/14
 */
@RestController
public class StorageApi {

    @Resource
    private IStorageService storageService;

    /**
     * 扣减库存
     */
    @RequestMapping("/storage/decrease")
    public CommonResult decrease(Long productId, Integer count) {
        storageService.decrease(productId, count);
        return new CommonResult(200, "扣减库存成功！");
    }
}
